<template>
  <div>
    <keep-alive>
      <!-- <component :is="compName"></component> -->
      <router-view></router-view>
    </keep-alive>
    <van-tabbar route active-color="chocolate">
      <van-tabbar-item replace to="/index/home" icon="wap-home-o"
        >首页</van-tabbar-item
      >
      <van-tabbar-item replace to="/index/category" icon="apps-o"
        >分类</van-tabbar-item
      >
      <van-tabbar-item replace to="/index/collection" icon="apps-o"
        >收藏</van-tabbar-item
      >
    </van-tabbar>
    <!-- <footer class="footer-container">
      <ul class="f-list">
        <li
          class="f-item"
          :class="index == 0 ? 'active' : ''"
          @click="toggle(0, 'YimiHome')"
        >
          <van-icon name="wap-home-o" size="30px" />
          <p>首页</p>
        </li>
        <li
          class="f-item"
          :class="index == 1 ? 'active' : ''"
          @click="toggle(1, 'YimiCategory')"
        >
          <van-icon name="apps-o" size="30px" />
          <p>分类</p>
        </li>
        <li
          class="f-item"
          :class="index == 2 ? 'active' : ''"
          @click="toggle(2, 'YimiCollection')"
        >
          <van-icon name="star-o" size="30px" />
          <p>收藏</p>
        </li>
      </ul>
    </footer> -->
  </div>
</template>

<script>
import YimiCategory from "./yimi-category.vue";
import YimiCollection from "./yimi-collection.vue";
import YimiHome from "./yimi-home.vue";
export default {
  name: "compFooter",
  components: { YimiHome, YimiCategory, YimiCollection },
  data() {
    return {
      index: 0,
      compName: "YimiHome",
    };
  },
  methods: {
    toggle(i, name) {
      this.index = i;
      this.compName = name;
    },
  },
};
</script>

<style lang="less" scoped>
.footer-container {
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 1000;
  background-color: #fff;
  .f-list {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .f-item {
      flex-grow: 1;
      text-align: center;
      color: #666;
      p {
        font-size: 16px;
      }
    }
    .active {
      color: chocolate;
    }
  }
}
.van-tabbar {
  z-index: 1000;
}
</style>